
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:stripe_terminal_tap_to_pay/stripe_terminal_tap_to_pay.dart';

import 'api.dart';

class StripeController extends GetxController {
  BuildContext? context;
  StripeTerminalTapToPay stripeTerminalTapToPay = StripeTerminalTapToPay();
  RxString connectionStatus = "".obs;
  RxString onPayMessage = "".obs;
  @override
  void onInit() {
    super.onInit();
    stripeTerminalTapToPay.permissionAllowed();
    stripeTerminalTapToPay.onSuccessNFCBack = (e){
      connectionStatus.value = e;
    };
    stripeTerminalTapToPay.onPayMessageBack = (e){
      onPayMessage.value = e;
    };
  }

  Future<void> init(String localId) async{
    Api().getConnectionToken().then((value) {
       stripeTerminalTapToPay.init(localId,value);
    });
  }

}